/*    */ package com.zimbra.cs.account.callback;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.AttributeCallback;
/*    */ import com.zimbra.cs.account.AttributeCallback.SingleValueMod;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import java.nio.charset.Charset;
/*    */ import java.nio.charset.IllegalCharsetNameException;
/*    */ import java.nio.charset.UnsupportedCharsetException;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class MailCharset
/*    */   extends AttributeCallback
/*    */ {
/*    */   public void preModify(CallbackContext context, String attrName, Object value, Map attrsToModify, Entry entry)
/*    */     throws ServiceException
/*    */   {
/* 36 */     String charset = null;
/* 37 */     AttributeCallback.SingleValueMod mod = singleValueMod(attrName, value);
/* 38 */     if (mod.unsetting()) {
/* 39 */       return;
/*    */     }
/* 41 */     charset = mod.value();
/*    */     
/*    */     try
/*    */     {
/* 45 */       Charset.forName(charset);
/*    */     } catch (IllegalCharsetNameException e) {
/* 47 */       throw ServiceException.INVALID_REQUEST("charset name " + charset + " is illegal", e);
/*    */     } catch (UnsupportedCharsetException e) {
/* 49 */       throw ServiceException.INVALID_REQUEST("no support for charset " + charset + " is available in this instance of the Java virtual machine", e);
/*    */     }
/*    */   }
/*    */   
/*    */   public void postModify(CallbackContext context, String attrName, Entry entry) {}
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/callback/MailCharset.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */